package com.ykt.controller;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.ext.route.ControllerBind;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Record;
import com.ykt.model.Video;
import com.ykt.vo.page.TreeNode;

@ControllerBind(controllerKey="/video")
public class VideoController extends BaseController<Video> {

	public VideoController() {
		super(Video.class);
	}
	
	/**
	 * 下拉列表多选
	 */
	public void combotree() {

		String sql="select id,title from video";
		
		List<Record> dataList = Db.find(sql);
		List<TreeNode> list = new ArrayList<TreeNode>();
		for(Record r : dataList ){
			TreeNode rootNode = new TreeNode();
			rootNode.setId(r.getInt("id"));
			rootNode.setText(r.getStr("title"));
			rootNode.setIconCls("icon-home");
			rootNode.setCanChk(false);
			list.add(rootNode);
		}
		this.renderJson(list);
	}
	
}
